import os
import requests

def download_image(url, save_path):
    response = requests.get(url)
    makedir(save_path)
    with open(save_path, "wb") as f:
        f.write(response.content)
    print("Downloaded")

# //创建目录
def makedir(save_path):
    savePath = str(save_path)
    # //如果没有目录跳过
    if not savePath.__contains__("/"):
        return
    savePath = savePath[0:savePath.rindex("/")]
    os.makedirs(savePath, exist_ok=True)
